package main

func diStringMatch(s string) []int {
	b := []byte(s)
	res := make([]int, 0)
	low := 0
	high := len(b)
	//遇I填0++，与D填n--，走后一个填low或high
	for i := 0; i < len(b); i++ {
		if b[i] == 'I' {
			res = append(res, low)
			low++
		} else if b[i] == 'D' {
			res = append(res, high)
			high--
		}
	}
	res = append(res, low)
	return res
}
